Notebook: Ensure menu_label updates with tab_label
authorDaniel Boles <dboles.src@gmail.com>
Fri, 12 Oct 2018 22:12:53 +0000 (23:12 +0100)
committerDaniel Boles <dboles.src@gmail.com>
Fri, 12 Oct 2018 22:50:12 +0000 (23:50 +0100)
commit4e884b6056fcc281eb84ff9543720bbea867fd9b
tree14a78dbeb39bf7e40aef86fbcd9463169f302ba9
parent9cbd3ac017a993889c5c663603db7867e0d4ed13
Notebook: Ensure menu_label updates with tab_label

This was noticed in Firefox and demonstrated using a GtkBuilder ui file.
buildable_add_child() calls set_tab_label(), but the latter did nothing
to update the menu_label corresponding to that tab with the new text.
Using Builder to populate the tab child, only tabs other than last got
the right non-default labels, and even that was mostly coincidental, as
adding the main child called update_labels() via real_insert_page(), so
it took effect when the 2nd last main child is added, updating the rest
but leaving the last with the default label, not that given in Builder.

Fix by factoring out the code from child_reordered() to a new helper
menu_item_recreate() and calling that in set_tab_label(), so that
whenever the tab_label is updated, so is its corresponding menu_label.

This fixes the reported case and presumably others that we could write.

fixes https://gitlab.gnome.org/GNOME/gtk/issues/1397
gtk/gtknotebook.c